/**
 * @USER: Administrator
 * @DATE: 2024/10/5 上午9:46
 * @VERSION: 1.0.0
 */
public class LC2733 {
    public static void main(String[] args) {
        LC2733 lc2733 = new LC2733();
        System.out.println(lc2733.findNonMinOrMax(new int[]{1,2}));
    }

    public int findNonMinOrMax(int[] nums) {
        int min=nums[0],max=nums[0];
        for (int j : nums) {
            if (j < min) {
                min = j;
            }
            if (j > max) {
                max = j;
            }
        }

        for (int num : nums) {
            if (num!=min && num!=max) {
                return num;
            }
        }
        return -1;
    }

}
